package com.apache.bid.service.impl;

import java.util.List;

import com.apache.api.vo.ParamsVo;
import com.apache.bid.common.WbdStringUtil;
import com.apache.bid.entity.BidItemHistory;
import com.apache.bid.manager.BidItemHistoryManager;
import com.apache.cache.util.Validator;
import com.apache.database.db.IDao;
import com.apache.database.model.MethodParam;
import com.apache.database.model.Page;
import com.apache.exception.BusinessException;

public class BidItemHistoryManagerImpl implements BidItemHistoryManager {

	protected IDao bidItemHistoryDao;
	protected final String entityName = "com.apache.bid.entity.BidItemHistory";

	public void setBidItemHistoryDao(IDao bidItemHistoryDao) {
		this.bidItemHistoryDao = bidItemHistoryDao;
	}

	public String saveInfo(ParamsVo<BidItemHistory> vo) throws BusinessException {
		BidItemHistory bidItemHistory = vo.getObj();
		String infoId = Validator.generate();
		//定义对象缓存KEY,如果不需要缓存对象请不要对变量赋值，如果要缓存对象建议使用infoId
		String cacheKey = "";
		//String cacheKey="bidItemHistory_"+infoId;
		if (Validator.isNull(bidItemHistory.getItemId())) {
			bidItemHistory.setItemId(infoId);
		}
		MethodParam param = new MethodParam("BidItemHistory", cacheKey, "", entityName);
		param.setVaule(bidItemHistory);
		if (bidItemHistoryDao.insert(param)) {
			return bidItemHistory.getItemId();
		}
		return "";
	}

	public boolean editInfo(ParamsVo<BidItemHistory> vo) throws BusinessException {
		BidItemHistory bidItemHistory = vo.getObj();
		if (Validator.isNotNull(bidItemHistory.getItemId())) {
			String cacheKey = "";
			//String cacheKey="bidItemHistory_"+bidItemHistory.getItemId();
			MethodParam param = new MethodParam("BidItemHistory", cacheKey, "", entityName);
			param.setVaule(bidItemHistory);
			return bidItemHistoryDao.edit(param);
		}
		return false;
	}

	public boolean deleteInfo(ParamsVo<BidItemHistory> vo) throws BusinessException {
		String infoId = vo.getInfoId();
		if (Validator.isNull(infoId)) {
			return false;
		}
		String cacheKey = "";
		//String cacheKey="bidItemHistory_"+infoId;
		String mark = Validator.getDefaultStr(String.valueOf(vo.getParams("isDelete")), "true");
		MethodParam param = new MethodParam("ById", cacheKey, "", entityName);
		param.setInfoId(infoId);
		BidItemHistory info = (BidItemHistory) bidItemHistoryDao.selectById(param);
		if (Validator.isEmpty(info)) {
			return false;
		}
		param.setVaule(info);//此处需要先将状态值赋值为删除状态
		if ("false".equals(mark)) {//逻辑删除
			param.setKey("BidItemHistory");
			return bidItemHistoryDao.edit(param);
		} else {
			param.setParams("itemId", infoId);
			param.setDelete(true);
			return bidItemHistoryDao.delete(param);
		}
	}

	public Object getInfoById(ParamsVo<BidItemHistory> vo) {
		String infoId = vo.getInfoId();
		String cacheKey = "";
		//String cacheKey="bidItemHistory_"+infoId;
		if (Validator.isNull(infoId)) {
			return null;
		}
		MethodParam param = new MethodParam("ById", cacheKey, "", entityName);
		param.setInfoId(infoId);
		return bidItemHistoryDao.selectById(param);
	}

	public Object execute(ParamsVo<BidItemHistory> vo) {
		// TODO Auto-generated method stub
		return null;
	}

	public Page getPageInfo(ParamsVo<BidItemHistory> vo) {
		MethodParam param = setMethodParams(vo, 2);
		int pageSize = Integer.valueOf(Validator.getDefaultStr(String.valueOf(vo.getParams("pageSize")), "10"));
		int pageIndex = Integer.valueOf(Validator.getDefaultStr(String.valueOf(vo.getParams("pageIndex")), "1"));
		param.setPageIndex(pageIndex);
		param.setPageSize(pageSize);
		String orderBy = Validator.getDefaultStr(String.valueOf(vo.getParams("orderBy")), " order by close_time desc ");
		param.setParams("orderBy", orderBy);
		Page page = bidItemHistoryDao.pageSelect(param);
		return page;
	}

	public List<BidItemHistory> getList(ParamsVo<BidItemHistory> vo) {
		MethodParam param = setMethodParams(vo, 2);
		String orderBy = Validator.getDefaultStr(String.valueOf(vo.getParams("orderBy")), " order by close_time desc ");
		param.setParams("orderBy", orderBy);
		return bidItemHistoryDao.select(param);
	}

	public long countInfo(ParamsVo<BidItemHistory> vo) {
		MethodParam param = setMethodParams(vo, 1);
		return bidItemHistoryDao.count(param);
	}

	private MethodParam setMethodParams(ParamsVo<BidItemHistory> vo, int type) {
		String methodKey = Validator.getDefaultStr(vo.getMethodKey(), "ByProperty");
		StringBuffer sb = new StringBuffer(bidItemHistoryDao.getSql(type));
		MethodParam param = new MethodParam(methodKey, "", "", entityName);
		param.setResultCache(false);
		BidItemHistory bidItemHistory = vo.getObj();
		if (Validator.isNotNull(bidItemHistory.getSessionId())) {
			sb.append(" and sessionId = :sessionId");
			param.setParams("sessionId", bidItemHistory.getSessionId());
		}
		if (Validator.isNotNull(bidItemHistory.getSessionType())) {
			sb.append(" and sessionType = :sessionType");
			param.setParams("sessionType", bidItemHistory.getSessionType());
		}
		if (Validator.isNotNull(bidItemHistory.getSessionName())) {
			String value = WbdStringUtil.getChUTF8(bidItemHistory.getSessionName());
			sb.append(" and sessionName like '%" + value + "%' ");
			param.setParams("sessionName", " like '%" + value + "%' ");
		}
		if (Validator.isNotNull(bidItemHistory.getGroupId())) {
			sb.append(" and groupId = :groupId");
			param.setParams("groupId", bidItemHistory.getGroupId());
		}
		if (Validator.isNotNull(bidItemHistory.getGroupName())) {
			sb.append(" and groupName = :groupName");
			param.setParams("groupName", bidItemHistory.getGroupName());
		}
		if (Validator.isNotNull(bidItemHistory.getBidMode())) {
			sb.append(" and bidMode = :bidMode");
			param.setParams("bidMode", bidItemHistory.getBidMode());
		}
		if (Validator.isNotNull(bidItemHistory.getIfBidDyn())) {
			sb.append(" and ifBidDyn = :ifBidDyn");
			param.setParams("ifBidDyn", bidItemHistory.getIfBidDyn());
		}
		if (Validator.isNotNull(bidItemHistory.getItemNo())) {
			sb.append(" and itemNo = :itemNo");
			param.setParams("itemNo", bidItemHistory.getItemNo());
		}
		if (Validator.isNotNull(bidItemHistory.getItemName())) {
			String value = WbdStringUtil.getChUTF8(bidItemHistory.getItemName());
			sb.append(" and itemName  like '%" + value + "%' ");
			param.setParams("itemName", " like '%" + value + "%' ");
		}
		if (Validator.isNotNull(bidItemHistory.getItemType())) {
			sb.append(" and itemType = :itemType");
			param.setParams("itemType", bidItemHistory.getItemType());
		}
		if (Validator.isNotNull(bidItemHistory.getItemTypeName())) {
			sb.append(" and itemTypeName = :itemTypeName");
			param.setParams("itemTypeName", bidItemHistory.getItemTypeName());
		}
		if (Validator.isNotNull(bidItemHistory.getItemSubname())) {
			sb.append(" and itemSubname = :itemSubname");
			param.setParams("itemSubname", bidItemHistory.getItemSubname());
		}
		if (Validator.isNotNull(bidItemHistory.getItemStatus())) {
			sb.append(" and itemStatus = :itemStatus");
			param.setParams("itemStatus", bidItemHistory.getItemStatus());
		}
		if (Validator.isNotNull(bidItemHistory.getItemNum())) {
			sb.append(" and itemNum = :itemNum");
			param.setParams("itemNum", bidItemHistory.getItemNum());
		}
		if (Validator.isNotNull(bidItemHistory.getItemNumDesc())) {
			sb.append(" and itemNumDesc = :itemNumDesc");
			param.setParams("itemNumDesc", bidItemHistory.getItemNumDesc());
		}
		if (Validator.isNotNull(bidItemHistory.getItemUnitName())) {
			sb.append(" and itemUnitName = :itemUnitName");
			param.setParams("itemUnitName", bidItemHistory.getItemUnitName());
		}
		if (Validator.isNotNull(bidItemHistory.getIncrementGroup())) {
			sb.append(" and incrementGroup = :incrementGroup");
			param.setParams("incrementGroup", bidItemHistory.getIncrementGroup());
		}
		if (Validator.isNotNull(bidItemHistory.getIncrementValue())) {
			sb.append(" and incrementValue = :incrementValue");
			param.setParams("incrementValue", bidItemHistory.getIncrementValue());
		}
		if (Validator.isNotNull(bidItemHistory.getFirstValuePre())) {
			sb.append(" and firstValuePre = :firstValuePre");
			param.setParams("firstValuePre", bidItemHistory.getFirstValuePre());
		}
		if (Validator.isNotNull(bidItemHistory.getOncevalue())) {
			sb.append(" and oncevalue = :oncevalue");
			param.setParams("oncevalue", bidItemHistory.getOncevalue());
		}
		if (Validator.isNotNull(bidItemHistory.getHoldvalue())) {
			sb.append(" and holdvalue = :holdvalue");
			param.setParams("holdvalue", bidItemHistory.getHoldvalue());
		}
		if (Validator.isNotNull(bidItemHistory.getHoldNoticeTime())) {
			sb.append(" and holdNoticeTime = :holdNoticeTime");
			param.setParams("holdNoticeTime", bidItemHistory.getHoldNoticeTime());
		}
		if (Validator.isNotNull(bidItemHistory.getDecimalCount())) {
			sb.append(" and decimalCount = :decimalCount");
			param.setParams("decimalCount", bidItemHistory.getDecimalCount());
		}
		if (Validator.isNotNull(bidItemHistory.getCurrency())) {
			sb.append(" and currency = :currency");
			param.setParams("currency", bidItemHistory.getCurrency());
		}
		if (Validator.isNotNull(bidItemHistory.getPriceUnit())) {
			sb.append(" and priceUnit = :priceUnit");
			param.setParams("priceUnit", bidItemHistory.getPriceUnit());
		}
		if (Validator.isNotNull(bidItemHistory.getAllowUpdateTimes())) {
			sb.append(" and allowUpdateTimes = :allowUpdateTimes");
			param.setParams("allowUpdateTimes", bidItemHistory.getAllowUpdateTimes());
		}
		if (Validator.isNotNull(bidItemHistory.getBidWay())) {
			sb.append(" and bidWay = :bidWay");
			param.setParams("bidWay", bidItemHistory.getBidWay());
		}
		if (Validator.isNotNull(bidItemHistory.getPriceFlag())) {
			sb.append(" and priceFlag = :priceFlag");
			param.setParams("priceFlag", bidItemHistory.getPriceFlag());
		}
		if (Validator.isNotNull(bidItemHistory.getFlagTime())) {
			sb.append(" and flagTime = :flagTime");
			param.setParams("flagTime", bidItemHistory.getFlagTime());
		}
		if (Validator.isNotNull(bidItemHistory.getBailPrice())) {
			sb.append(" and bailPrice = :bailPrice");
			param.setParams("bailPrice", bidItemHistory.getBailPrice());
		}
		if (Validator.isNotNull(bidItemHistory.getCreateTime())) {
			sb.append(" and createTime = :createTime");
			param.setParams("createTime", bidItemHistory.getCreateTime());
		}
		if (Validator.isNotNull(bidItemHistory.getAuditTime())) {
			sb.append(" and auditTime = :auditTime");
			param.setParams("auditTime", bidItemHistory.getAuditTime());
		}
		if (Validator.isNotNull(bidItemHistory.getOpenTimePre())) {
			sb.append(" and openTimePre = :openTimePre");
			param.setParams("openTimePre", bidItemHistory.getOpenTimePre());
		}
		if (Validator.isNotNull(bidItemHistory.getFirstBidTimePre())) {
			sb.append(" and firstBidTimePre = :firstBidTimePre");
			param.setParams("firstBidTimePre", bidItemHistory.getFirstBidTimePre());
		}
		if (Validator.isNotNull(bidItemHistory.getCloseTimePre())) {
			sb.append(" and closeTimePre = :closeTimePre");
			param.setParams("closeTimePre", bidItemHistory.getCloseTimePre());
		}
		if (Validator.isNotNull(bidItemHistory.getLimitTime())) {
			sb.append(" and limitTime = :limitTime");
			param.setParams("limitTime", bidItemHistory.getLimitTime());
		}
		if (Validator.isNotNull(bidItemHistory.getDelayControl())) {
			sb.append(" and delayControl = :delayControl");
			param.setParams("delayControl", bidItemHistory.getDelayControl());
		}
		if (Validator.isNotNull(bidItemHistory.getDelayUnit())) {
			sb.append(" and delayUnit = :delayUnit");
			param.setParams("delayUnit", bidItemHistory.getDelayUnit());
		}
		if (Validator.isNotNull(bidItemHistory.getDelayPeriod())) {
			sb.append(" and delayPeriod = :delayPeriod");
			param.setParams("delayPeriod", bidItemHistory.getDelayPeriod());
		}
		if (Validator.isNotNull(bidItemHistory.getDelayDeadTime())) {
			sb.append(" and delayDeadTime = :delayDeadTime");
			param.setParams("delayDeadTime", bidItemHistory.getDelayDeadTime());
		}
		if (Validator.isNotNull(bidItemHistory.getDelayPeriodMax())) {
			sb.append(" and delayPeriodMax = :delayPeriodMax");
			param.setParams("delayPeriodMax", bidItemHistory.getDelayPeriodMax());
		}
		if (Validator.isNotNull(bidItemHistory.getIfFee())) {
			sb.append(" and ifFee = :ifFee");
			param.setParams("ifFee", bidItemHistory.getIfFee());
		}
		if (Validator.isNotNull(bidItemHistory.getAllowFirstValue())) {
			sb.append(" and allowFirstValue = :allowFirstValue");
			param.setParams("allowFirstValue", bidItemHistory.getAllowFirstValue());
		}
		if (Validator.isNotNull(bidItemHistory.getAllowRepeat())) {
			sb.append(" and allowRepeat = :allowRepeat");
			param.setParams("allowRepeat", bidItemHistory.getAllowRepeat());
		}
		if (Validator.isNotNull(bidItemHistory.getAllowEndPrio())) {
			sb.append(" and allowEndPrio = :allowEndPrio");
			param.setParams("allowEndPrio", bidItemHistory.getAllowEndPrio());
		}
		if (Validator.isNotNull(bidItemHistory.getAllowHallPrio())) {
			sb.append(" and allowHallPrio = :allowHallPrio");
			param.setParams("allowHallPrio", bidItemHistory.getAllowHallPrio());
		}
		if (Validator.isNotNull(bidItemHistory.getAllowPrioTime())) {
			sb.append(" and allowPrioTime = :allowPrioTime");
			param.setParams("allowPrioTime", bidItemHistory.getAllowPrioTime());
		}
		if (Validator.isNotNull(bidItemHistory.getAllowAdd())) {
			sb.append(" and allowAdd = :allowAdd");
			param.setParams("allowAdd", bidItemHistory.getAllowAdd());
		}
		if (Validator.isNotNull(bidItemHistory.getAllowAddTime())) {
			sb.append(" and allowAddTime = :allowAddTime");
			param.setParams("allowAddTime", bidItemHistory.getAllowAddTime());
		}
		if (Validator.isNotNull(bidItemHistory.getPrioControl())) {
			sb.append(" and prioControl = :prioControl");
			param.setParams("prioControl", bidItemHistory.getPrioControl());
		}
		if (Validator.isNotNull(bidItemHistory.getEndPrioDays())) {
			sb.append(" and endPrioDays = :endPrioDays");
			param.setParams("endPrioDays", bidItemHistory.getEndPrioDays());
		}
		if (Validator.isNotNull(bidItemHistory.getBidInterval())) {
			sb.append(" and bidInterval = :bidInterval");
			param.setParams("bidInterval", bidItemHistory.getBidInterval());
		}
		if (Validator.isNotNull(bidItemHistory.getBidIntervalLimit())) {
			sb.append(" and bidIntervalLimit = :bidIntervalLimit");
			param.setParams("bidIntervalLimit", bidItemHistory.getBidIntervalLimit());
		}
		if (Validator.isNotNull(bidItemHistory.getIsPreview())) {
			sb.append(" and isPreview = :isPreview");
			param.setParams("isPreview", bidItemHistory.getIsPreview());
		}
		if (Validator.isNotNull(bidItemHistory.getItemSource())) {
			sb.append(" and itemSource = :itemSource");
			param.setParams("itemSource", bidItemHistory.getItemSource());
		}
		if (Validator.isNotNull(bidItemHistory.getItemBrand())) {
			sb.append(" and itemBrand = :itemBrand");
			param.setParams("itemBrand", bidItemHistory.getItemBrand());
		}
		if (Validator.isNotNull(bidItemHistory.getItemArea())) {
			sb.append(" and itemArea = :itemArea");
			param.setParams("itemArea", bidItemHistory.getItemArea());
		}
		if (Validator.isNotNull(bidItemHistory.getPackId())) {
			sb.append(" and packId = :packId");
			param.setParams("packId", bidItemHistory.getPackId());
		}
		if (Validator.isNotNull(bidItemHistory.getProId())) {
			sb.append(" and proId = :proId");
			param.setParams("proId", bidItemHistory.getProId());
		}
		if (Validator.isNotNull(bidItemHistory.getSysId())) {
			sb.append(" and sysId = :sysId");
			param.setParams("sysId", bidItemHistory.getSysId());
		}
		if (Validator.isNotNull(bidItemHistory.getPicUrl())) {
			sb.append(" and picUrl = :picUrl");
			param.setParams("picUrl", bidItemHistory.getPicUrl());
		}
		if (Validator.isNotNull(bidItemHistory.getPicUrlSmall())) {
			sb.append(" and picUrlSmall = :picUrlSmall");
			param.setParams("picUrlSmall", bidItemHistory.getPicUrlSmall());
		}
		if (Validator.isNotNull(bidItemHistory.getOrgEname())) {
			sb.append(" and orgEname = :orgEname");
			param.setParams("orgEname", bidItemHistory.getOrgEname());
		}
		if (Validator.isNotNull(bidItemHistory.getOrgCname())) {
			sb.append(" and orgCname = :orgCname");
			param.setParams("orgCname", bidItemHistory.getOrgCname());
		}
		if (Validator.isNotNull(bidItemHistory.getFallDecrement())) {
			sb.append(" and fallDecrement = :fallDecrement");
			param.setParams("fallDecrement", bidItemHistory.getFallDecrement());
		}
		if (Validator.isNotNull(bidItemHistory.getFallLimitTime())) {
			sb.append(" and fallLimitTime = :fallLimitTime");
			param.setParams("fallLimitTime", bidItemHistory.getFallLimitTime());
		}
		if (Validator.isNotNull(bidItemHistory.getFallLowerstPrice())) {
			sb.append(" and fallLowerstPrice = :fallLowerstPrice");
			param.setParams("fallLowerstPrice", bidItemHistory.getFallLowerstPrice());
		}
		if (Validator.isNotNull(bidItemHistory.getModifyTime())) {
			sb.append(" and modifyTime = :modifyTime");
			param.setParams("modifyTime", bidItemHistory.getModifyTime());
		}
		if (Validator.isNotNull(bidItemHistory.getNetBidKind())) {
			sb.append(" and netBidKind = :netBidKind");
			param.setParams("netBidKind", bidItemHistory.getNetBidKind());
		}
		if (Validator.isNotNull(bidItemHistory.getOrderNumber())) {
			sb.append(" and orderNumber = :orderNumber");
			param.setParams("orderNumber", bidItemHistory.getOrderNumber());
		}
		if (Validator.isNotNull(bidItemHistory.getTakeTime())) {
			sb.append(" and takeTime = :takeTime");
			param.setParams("takeTime", bidItemHistory.getTakeTime());
		}
		if (Validator.isNotNull(bidItemHistory.getMsgStatus())) {
			sb.append(" and msgStatus = :msgStatus");
			param.setParams("msgStatus", bidItemHistory.getMsgStatus());
		}
		if (Validator.isNotNull(bidItemHistory.getOverPrice())) {
			sb.append(" and overPrice = :overPrice");
			param.setParams("overPrice", bidItemHistory.getOverPrice());
		}
		if (Validator.isNotNull(bidItemHistory.getYjl())) {
			sb.append(" and yjl = :yjl");
			param.setParams("yjl", bidItemHistory.getYjl());
		}
		if (Validator.isNotNull(bidItemHistory.getOpenTime())) {
			sb.append(" and openTime = :openTime");
			param.setParams("openTime", bidItemHistory.getOpenTime());
		}
		if (Validator.isNotNull(bidItemHistory.getFirstValue())) {
			sb.append(" and firstValue = :firstValue");
			param.setParams("firstValue", bidItemHistory.getFirstValue());
		}
		if (Validator.isNotNull(bidItemHistory.getFirstBidTime())) {
			sb.append(" and firstBidTime = :firstBidTime");
			param.setParams("firstBidTime", bidItemHistory.getFirstBidTime());
		}
		if (Validator.isNotNull(bidItemHistory.getLastValue())) {
			sb.append(" and lastValue = :lastValue");
			param.setParams("lastValue", bidItemHistory.getLastValue());
		}
		if (Validator.isNotNull(bidItemHistory.getAmount())) {
			sb.append(" and amount = :amount");
			param.setParams("amount", bidItemHistory.getAmount());
		}
		if (Validator.isNotNull(bidItemHistory.getUserId())) {
			sb.append(" and userId = :userId");
			param.setParams("userId", bidItemHistory.getUserId());
		}
		if (Validator.isNotNull(bidItemHistory.getUserName())) {
			sb.append(" and userName = :userName");
			param.setParams("userName", bidItemHistory.getUserName());
		}
		if (Validator.isNotNull(bidItemHistory.getLastRightLevel())) {
			sb.append(" and lastRightLevel = :lastRightLevel");
			param.setParams("lastRightLevel", bidItemHistory.getLastRightLevel());
		}
		if (Validator.isNotNull(bidItemHistory.getBidTimes())) {
			sb.append(" and bidTimes = :bidTimes");
			param.setParams("bidTimes", bidItemHistory.getBidTimes());
		}
		if (Validator.isNotNull(bidItemHistory.getCloseTime())) {
			sb.append(" and closeTime = :closeTime");
			param.setParams("closeTime", bidItemHistory.getCloseTime());
		}
		if (Validator.isNotNull(bidItemHistory.getLastBidTime())) {
			sb.append(" and lastBidTime = :lastBidTime");
			param.setParams("lastBidTime", bidItemHistory.getLastBidTime());
		}
		if (Validator.isNotNull(bidItemHistory.getPauseTime())) {
			sb.append(" and pauseTime = :pauseTime");
			param.setParams("pauseTime", bidItemHistory.getPauseTime());
		}
		if (Validator.isNotNull(bidItemHistory.getDelayTimes())) {
			sb.append(" and delayTimes = :delayTimes");
			param.setParams("delayTimes", bidItemHistory.getDelayTimes());
		}
		if (Validator.isNotNull(bidItemHistory.getDelayEndFlag())) {
			sb.append(" and delayEndFlag = :delayEndFlag");
			param.setParams("delayEndFlag", bidItemHistory.getDelayEndFlag());
		}
		if (Validator.isNotNull(bidItemHistory.getIfAddPrice())) {
			sb.append(" and ifAddPrice = :ifAddPrice");
			param.setParams("ifAddPrice", bidItemHistory.getIfAddPrice());
		}
		if (Validator.isNotNull(bidItemHistory.getIfPrioFlag())) {
			sb.append(" and ifPrioFlag = :ifPrioFlag");
			param.setParams("ifPrioFlag", bidItemHistory.getIfPrioFlag());
		}
		if (Validator.isNotNull(bidItemHistory.getBidNum())) {
			sb.append(" and bidNum = :bidNum");
			param.setParams("bidNum", bidItemHistory.getBidNum());
		}
		if (Validator.isNotNull(bidItemHistory.getWeight())) {
			sb.append(" and weight = :weight");
			param.setParams("weight", bidItemHistory.getWeight());
		}
		if (Validator.isNotNull(bidItemHistory.getSpare1())) {
			sb.append(" and spare1 = :spare1");
			param.setParams("spare1", bidItemHistory.getSpare1());
		}
		if (Validator.isNotNull(bidItemHistory.getSpare2())) {
			sb.append(" and spare2 = :spare2");
			param.setParams("spare2", bidItemHistory.getSpare2());
		}
		if (Validator.isNotNull(bidItemHistory.getSpare3())) {
			sb.append(" and spare3 = :spare3");
			param.setParams("spare3", bidItemHistory.getSpare3());
		}
		if (Validator.isNotNull(bidItemHistory.getSpare4())) {
			sb.append(" and spare4 = :spare4");
			param.setParams("spare4", bidItemHistory.getSpare4());
		}
		if (Validator.isNotNull(bidItemHistory.getSpare5())) {
			sb.append(" and spare5 = :spare5");
			param.setParams("spare5", bidItemHistory.getSpare5());
		}
		if (Validator.isNotNull(bidItemHistory.getIfRight())) {
			sb.append(" and ifRight = :ifRight");
			param.setParams("ifRight", bidItemHistory.getIfRight());
		}
		if (Validator.isNotNull(bidItemHistory.getvFlag())) {
			sb.append(" and vFlag = :vFlag");
			param.setParams("vFlag", bidItemHistory.getvFlag());
		}
		if (Validator.isNotNull(bidItemHistory.getDirection())) {
			sb.append(" and direction = :direction");
			param.setParams("direction", bidItemHistory.getDirection());
		}

		param.setSqlStr(sb.toString());
		return param;
	}
}
